import { ElMessageBox } from 'element-plus';
import { ElMessage } from 'element-plus';

/**
 * 消息弹出框
 */
export const useMessageBox = {
  success(message) {
    return ElMessageBox.confirm(message, '提示', {
      confirmButtonText: '确定',
      cancelButtonText: '取消',
      type: 'success',
      center: true,
    })
  },
  warning(message) {
    return ElMessageBox.confirm(message, '提示', {
      confirmButtonText: '确定',
      cancelButtonText: '取消',
      type: 'warning',
      center: true,
    })
  },
}

/**
 * 消息提示
 */
export const useMessage = {
  /**
   * 成功消息
   * @param {*} options
   */
  success(options) {
    ElMessage.success(options)
  },
  warning(options) {
    ElMessage.warning(options)
  },
  info(options) {
    ElMessage.info(options)
  },
  error(options) {
    ElMessage.error(options)
  }
}